package cn.edu.usst.cs.goldfish.booking.meetingroom.typehandler;

import com.alibaba.excel.converters.Converter;

import com.alibaba.excel.enums.CellDataTypeEnum;

import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

import cn.edu.usst.cs.goldfish.booking.meetingroom.model.enums.MeetingStatus;

public class MeetingStatusConverter implements Converter<MeetingStatus> {
    @Override
    public Class<?> supportJavaTypeKey() {
        return MeetingStatus.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public WriteCellData<?> convertToExcelData(MeetingStatus value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return new WriteCellData<>(value != null ? value.name() : "");
    }
}
